<template>
  <div
    id="renew"
    class="dialog animated"
    :class="open? 'fadeIn':'fadeOut'"
    v-show="show"
    :style="{ visibility: visible ? 'visible' : 'hidden' }"
  >
    <div class="panel animated" :class="open? 'zoomIn':''">
      <payScheme
        v-show="step==1"
        ref="payScheme"
        @cancel="cancel"
        @nextStep="showPayConfirm"
      ></payScheme>
      <payConfirm
        v-show="step==2"
        ref="payConfirm"
        @cancel="cancel"
        @previousStep="showPayScheme"
      ></payConfirm>
    </div>
  </div>
</template>

<script>
import payScheme from "./renew_scheme"; //缴费学员缴费页
import payConfirm from "./renew_confirm"; //缴费学员缴费确认页

var vm;
export default {
  components: {
    payScheme,
    payConfirm,
  },
  data: function() {
    return {
      show: false,
      open: false,
      visible: false,
      step: 1,
      infoData: null
    };
  },
  methods: {
    init: function(infoData) {
      vm.show = true;
      setTimeout(function() {
        vm.open = true;
        vm.visible = true;
      }, 11);
      vm.step = 1;
      vm.infoData = infoData;
      vm.$refs.payScheme.init(infoData);
    },
    cancel: function() {
      //隐藏弹窗
      vm.open = false;
      setTimeout(function() {
        vm.show = false;
        vm.step = 0;
      }, 11);
    },
    /**显示缴费收费方案 */
    showPayScheme() {
      vm.step = 1;
      vm.$refs.payScheme.init(vm.infoData);
    },
    /**显示缴费收费确认页 */
    showPayConfirm() {
      vm.step = 2;
      vm.$refs.payConfirm.init(vm.infoData);
    },
  },
  created: function() {
    vm = this;
  }
};
</script>
<style lang="scss">
#renew {
  .el-input__inner {
    border-radius: 0.1rem;
    font-size: 0.16rem;
    color: #666666;
    height: 0.36rem;
    line-height: 0.36rem;
  }
  .el-input__icon {
    line-height: 0.36rem;
  }
}
</style>
<style scoped src="@/style/module/dialog.css"></style>
<style scoped>
.panel {
  margin-top: 0.6rem;
  /*width: 12.44rem;*/
}
</style>